using System;

namespace ChessGameEngine
{
    public struct TilePosition : IEquatable<TilePosition>
    {
        public int I { get; set; }
        public int J { get; set; }

        public static TilePosition Default
        {
            get { return new TilePosition() { I = -1, J = -1 }; }
        }

        public bool Equals(TilePosition other)
        {
            return (this.I == other.I && this.J == other.J);
        }

        public override bool Equals(object obj)
        {
            if (obj is TilePosition)
            {
                return this.Equals((TilePosition)obj);
            }
            return false;
        }

        public override int GetHashCode()
        {
            return this.I.GetHashCode() ^ this.J.GetHashCode();
        }

        public static bool operator ==(TilePosition thisObj, TilePosition otherObj)
        {
            return thisObj.Equals(otherObj);
        }

        public static bool operator !=(TilePosition thisObj, TilePosition otherObj)
        {
            return !(thisObj == otherObj);
        }

        public override string ToString()
        {
            return string.Format("I={0}, J={1}", this.I, this.J);
        }
    }
}